package com.zhou.controller;

import com.zhou.service.LogisticsService;
import com.zhou.utis.result.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 物流信息
 * @author zhouyuyan
 */
@RestController
@RequestMapping("logistics")
public class LogisticsController {
    @Resource
    private LogisticsService logisticsService;

    @PostMapping("add")
    public Result add(){
        try {
            return Result.success(logisticsService.add());
        }catch (RuntimeException e){
            return Result.error(e.getMessage());
        }
    }
    @GetMapping("get_list")
    public Result getList(@RequestParam(defaultValue = "1") Integer page,
                          @RequestParam(defaultValue = "10") Integer pageSize){
        try {
            return Result.success(logisticsService.getList(page,pageSize));
        }catch (RuntimeException e){
            return Result.error(e.getMessage());
        }
    }
}
